###############
#  Figure 2a  #
###############
rm(list = ls());library(foreign);
install.packages("extrafont", dependencies=TRUE);library(extrafont)
install.packages("RColorBrewer", dependencies=TRUE);library(RColorBrewer)
darkgray<-"#3d3d3d";gray<-"#6a6a6a";lightgray<-"#cccccc"

a<-read.table("FEVD_Tw3.txt")
a[,3]<-a[,3]*100
a[,7]<-a[,7]*100
a[,11]<-a[,11]*100
a[,15]<-a[,15]*100

x<-as.table(rbind(a[,15],a[,3],a[,11],a[,7]))

par(family="Palatino")   
layout(rbind(1,2), heights=c(7,1))
par(mai=c(0.65,0.65,0.2,0.1),family="Palatino",oma=c(2,2,2,2),mgp=c(2, 0.5, 0),cex.lab=1.2,cex.axis=.8)
barplot(x, col=c("black",lightgray,gray,darkgray), names=c("1", "2","3","4","5","6","7"),ylim=c(0,20),beside=FALSE)
par(mai=c(0,0,0,0),family="Palatino")
plot.new()
legend(x="center",title="",horiz=TRUE,legend=c("Twitter","Gov->Reb.","US->Gov","Reb->Gov"),box.col="gray", fill=c("black",lightgray,gray,darkgray))

###########################################
#The line code below justifies the following claim in the paper: "accounting for up to 28\% of the foreign actors' impact on the US foreign policy."
###########################################
a[,15]/colSums(x)

###############
#  Figure 2b  #
###############

rm(list = ls());library(foreign);library(extrafont);library(RColorBrewer);
darkgray<-"#3d3d3d";gray<-"#6a6a6a";lightgray<-"#cccccc"

a<-read.table("FEVD_Tw4.txt")
a[,3]<-a[,3]*100
a[,7]<-a[,7]*100
a[,11]<-a[,11]*100
a[,15]<-a[,15]*100

x<-as.table(rbind(a[,15],a[,3],a[,11],a[,7]))

par(family="Palatino")   
layout(rbind(1,2), heights=c(7,1))
par(mai=c(0.65,0.65,0.2,0.1),family="Palatino",oma=c(2,2,2,2),mgp=c(2, 0.5, 0),cex.lab=1.2,cex.axis=.8)
barplot(x, col=c("black",lightgray,gray,darkgray), names=c("1", "2","3","4","5","6","7"),ylim=c(0,20),beside=FALSE)
par(mai=c(0,0,0,0),family="Palatino")
plot.new()
legend(x="center",title="",horiz=TRUE,legend=c("Twitter","Gov->Reb.","US->Gov","Reb->Gov"),box.col="gray", fill=c("black",lightgray,gray,darkgray))

